using System.Threading.Tasks;
using JoyfulHomeJourney.BackEnd.Infrastructure.Atrributes;
using JoyfulHomeJourney.BackEnd.Infrastructure.Dtos.Requests.Objects;
using JoyfulHomeJourney.BackEnd.Server.Interfaces;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
namespace JoyfulHomeJourney.BackEnd.Api.Admin.Controllers
{
	[TypeFilter(typeof(CheckLoginFilter), Arguments = new object[] { new string[] { "admin","carShop" } })]
	public class SysVipPackagesController : BaseController
	{
		private readonly ISysVipPackagesServer _sysVipPackagesServer;
		public SysVipPackagesController(ISysVipPackagesServer sysVipPackagesServer)
		{
			_sysVipPackagesServer = sysVipPackagesServer;
		}
		/// <summary>
		/// 添加
		/// </summary>
		/// <param name="dto"></param>
		/// <returns></returns>
		[HttpPost]
		[ActionLog("添加")]
		public async Task<IActionResult> Add(RequestSysVipPackagesDto dto)
		{
			return Send(await _sysVipPackagesServer.AddAsync(dto));
		}
		/// <summary>
		/// 删除
		/// </summary>
		/// <param name="dto"></param>
		/// <returns></returns>
		[HttpPost]
		[ActionLog("删除")]
		public async Task<IActionResult> Delete(RequestSysVipPackagesDto dto)
		{
			return Send(await _sysVipPackagesServer.DeleteAsync(dto));
		}
		/// <summary>
		/// 修改
		/// </summary>
		/// <param name="dto"></param>
		/// <returns></returns>
		[HttpPost]
		[ActionLog("修改")]
		public async Task<IActionResult> Update(RequestSysVipPackagesDto dto)
		{
			return Send(await _sysVipPackagesServer.UpdateAsync(dto));
		}
		/// <summary>
		/// 分页
		/// </summary>
		/// <param name="page"></param>
		/// <param name="limit"></param>
		/// <returns></returns>
		[HttpGet]
		public async Task<IActionResult> Pagination(int page,int limit, string key,string shopId,string field,bool? order)
		{
			return Send(await _sysVipPackagesServer.PaginationAsync(page,limit,key,shopId, field,order));
		}
        /// <summary>
        /// 查询会员套餐
        /// </summary>
        /// <param name="page"></param>
        /// <param name="limit"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<IActionResult> GetVipPackages()
        {
            return Send(await _sysVipPackagesServer.GetVipPackages());
        }
    }
}
